package di

// 在业务中不能修改Di中的任何信息
type Di struct {
	services map[string]interface{}
}

var instance *Di

func Instance() *Di {
	if instance == nil {
		instance = &Di{}
	}
	return instance
}

func (di *Di) Add(name string, service interface{}) {
	if di.services == nil {
		di.services = make(map[string]interface{})
	}
	di.services[name] = service
}

func (di Di) Get(name string) interface{} {
	return di.services[name]
}
